<template>
  <div class="carousel">
    <el-carousel :interval="4000" type="card" height="500px">
      <el-carousel-item v-for="(item, index) in imgList" :key="index">
        <img :src="'data:image/png;base64,' + item.img" alt="" />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>


<script>

import { getImage } from '@/api/content.js'
export default {
  components: {
  },
  data () {
    return {
      show: true,
      imgList: [] // 图片列表
    };
  },
  mounted () {
    this.getImg()
  },
  methods: {
    getImg () {
      const userId = sessionStorage.getItem('userId')
      getImage({
        userId: userId
      }).then(res => {
        if (res.success) {
          this.imgList = res.data
        }
      })
    }
  }
};
</script>

<style scoped>
.carousel {
  /* background-color: pink; */
  width: 1200px;
  margin: auto;
}

.el-carousel__item h3 {
  color: #475669;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
  text-align: center;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
</style>
